import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Align 组件',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(title: Text('Align 组件'),),
        body: Container(
          // height: 200,
          // width: 200,
          color: Colors.red,
          child: Align(
            //对齐方式
            // alignment: Alignment.bottomCenter,
            //0，0 为居中
            //1，1 右下
            //-1，-1左上
            alignment: Alignment(1.0, 0),
            //子视图的几倍，不写会填充最大，父容器不确定的情况下填充生效
            widthFactor: 3.0,
            heightFactor: 3.0,

            child: Container(
              color: Colors.green,
              width: 100.0,
              height: 50.0,
              child: Text('align',style: TextStyle(color: Colors.yellow),),
            ),
          ),
        ),
      ),
    );
  }
}
